Repository navigation
NPC_SetWeaponSkillLevel guard is inverted (doesn't do anything for valid skill ids) - #1298
Open
DignitySAMP wants to merge 2 commits into
Open
DignitySAMP wants to merge 2 commits into
DignitySAMP wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I encountered a problem with NPC's where
NPC_SetWeaponSkillLevelwouldn't actually set the skill level. My intent was for NPC's to hold pistols in a single hand. I noticed thatNPC_GetWeaponSkillLevelreturns 999 despite valid code:Expected:
200Actual:
999It seems this is the cause:
open.mp/Server/Components/NPCs/NPC/npc.cpp
Lines 735 to 737 in 2b4a69d
Looking at
getWeaponSkillLevel, the check insetWeaponSkillLevelis inverted and should beweaponSkill >= 0 && weaponSkill < 11. The first commit in this PR addresses that.While testing this I also noticed NPC's on the default skill (999) have two guns, which is valid, but the server still counts it as a single mag which plays the short reload for them. This makes them start shooting again before the reload animation is done.
isWeaponDoubleHandedcurrently checksskillLevel > 999while the client already dual wields at 999. The second commit changes that to>= 999.A Colt 45 on 999 then goes from clip 17 / reload 1300 ms to clip 34 / reload 2000 ms. Also tested and confirmed the fix with the sawn-off, Micro Uzi and Tec-9.
I ran this on 1.6.7.3218 master and tested/fixed it on an empty server with a 0.3.7-R1 client (CachyOS, arch btw).